<%@ page import="BusinessLogic.ControllerFacade" %>
<%@ page import="Domain.DataStructures.IUserData" %>
<%@ page errorPage="error.jsp" %>

<%
    ControllerFacade c = (ControllerFacade) session.getAttribute("c");
    IUserData user = c.getCurrentUser();    
%>
<h2>Hello <%=user.getFirstname()%>, Please select any action</h2>
<table>
    <tr><td>
        <form action="index.jsp" method="post">
            <p class="nevigationPanel">
                <input type="hidden" name="action" value="AddRecommendation" />
                <input type="submit" value="Add Recommendation" class="applicationButton" />
            </p>
        </form>
        <form action="index.jsp" method="post">
            <p class="nevigationPanel">
                <input type="hidden" name="action" value="GetRecommendation" />
                <%
                    if(c.allowedToViewRecommendations()){
                %>
                <input type="submit" value="Get Recommendation" class="applicationButton" />
                <%
                    }
                    else{
                %>
                <input type="submit" value="<%=c.getRecommendationsLeft() %> more Recommendations" class="applicationButton" disabled=disabled/><br /><span class="remark2">* Please recommend more movies, to get recommendations</span>
                <%
                    }
                %>
            </p>
        </form>
        <form action="index.jsp" method="post">
            <p class="nevigationPanel">
                <input type="hidden" name="action" value="ShowAllMovies" />
                <input type="submit" value="Show All Movies" class="applicationButton" />
            </p>
        </form>
        <form action="index.jsp" method="post">
            <p class="nevigationPanel">
                <input type="hidden" name="action" value="ShowAllUsers" />
                <input type="submit" value="Show All Users" class="applicationButton" />
            </p>
        </form>
        <br />

        <%
            if (user.isAdministrator()) {
        %>
        <form action="index.jsp" method="post">
            <p class="nevigationPanel">
                <input type="hidden" name="action" value="AddNewMovie" />
                <input type="submit" value="Add New Movie" class="administrationButton" />
            </p>
        </form>
        <form action="index.jsp" method="post">
            <p class="nevigationPanel">
                <input type="hidden" name="action" value="Register" />
                <input type="submit" value="Add New User" class="administrationButton" />
            </p>
        </form>
        <%
            }
            if (user.isManager() || user.isAdministrator()) {
        %>
        <form action="index.jsp" method="post">
            <p class="nevigationPanel">
                <input type="hidden" name="action" value="ReportsMenu" />
                <input type="submit" value="Reports" class="administrationButton" />
            </p>
        </form>
        <%
            }
        %>
        <br />
        <form action="index.jsp" method="post">
            <p class="nevigationPanel">
                <input type="hidden" name="action" value="Logout" />
                <input type="submit" value="Logout" class="applicationButton" />
            </p>
        </form>

    </td>
    </tr>
</table>